package Nowcoder;

public class NC207796 {
    static int end,Va,res ;
    static int[] val=null;
    static int[] gal=null;



    public static void main(String[] args) {
        int [] v = {3,2,1};
        int [] g = {4,3,2};
        int V = 3 ;

        end = v.length;
        Va = V;
        val = v;
        gal = g;

        dfs(0,0,0);
        System.out.println(res);

    }

    public static void dfs(int index,int vv,int gg){
        if(vv == Va){
            res = Math.max(res,gg);
            return;
        }
        if(index == end){return;}

        dfs(index+1,vv,gg);
        vv+=val[index];
        gg+=gal[index];
        dfs(index+1,vv,gg);

    }
}
